home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / x11 / lib / para_win.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-02  |  1.9 KB  |  78 lines

  1. /*
  2. %    PARA_WIN . C
  3. %
  4. %    for c_tuner.c
  5. */
  6.  
  7. #include "tuner.h"
  8.  
  9. void
  10. MapPixWindow(img, use_top, win_bg)
  11. image_information *img;
  12. int    use_top;
  13. {
  14. int    x = 0, font_height = img->font_h + 4,
  15.     y = use_top ? x : img->resize_h - font_height;
  16. #ifdef    SCROLLBAR_on_CANVAS
  17.     x += img->x;    y += img->y;
  18. #endif
  19.     if (img->pix_info_window == NULL) {
  20.     img->pix_info_window = XCreateSimpleWindow(img->dpy, img->window,
  21.         x, y, img->resize_w, font_height, 0, None, win_bg);
  22.     } else    XMoveResizeWindow(img->dpy, img->pix_info_window,
  23.                 x, y, img->resize_w, font_height);
  24.  
  25.     XMapWindow(img->dpy, img->pix_info_window);
  26. }
  27.  
  28. void
  29. DrawPixWindow(img, x, y, rle_form)
  30. image_information *img;
  31. {
  32. char    str[256];
  33. byte    *r=SAVED_RLE_ROW(img, y) + x, *g=r + img->w, *b;
  34. int    *lktg=lkt+MaxColors, *lktb=lkt+(MaxColors<<1);
  35.  
  36. if (rle_form)    y = img->h - y - 1;
  37. switch (img->dpy_channels) {
  38. case 1:
  39.     sprintf(str, "(%3d, %3d): (%3d)", x, y, *r);
  40.     if (tuner_flag && lkt)
  41.         x = strlen(str),    sprintf(str+x, " [%d]", lkt[*r]);
  42.     break;
  43. case 2:
  44.     sprintf(str, "(%3d, %3d): (%d, %d)", x, y, *r, *g);
  45.     break;
  46. case 3:
  47.     b = g + img->w;
  48.     sprintf(str, "(%3d, %3d): 0x%02X%02X%02X (%3d, %d, %d)",
  49.         x, y, *r, *g, *b, *r, *g, *b);
  50.     if (tuner_flag && lkt)
  51.         x = strlen(str),
  52.         sprintf(str+x, " [%d, %d, %d]", lkt[*r], lktg[*g], lktb[*b]);
  53. }
  54. if (abs(img->mag_fact) > 1)
  55.     x = strlen(str),    sprintf(str+x, " (%d MAG)", img->mag_fact);
  56. if (img->sub_img)
  57.     x = strlen(str),
  58.     sprintf(str+x, " {%d x %d sub_image}", img->sub_img_w, img->sub_img_h);
  59. XClearWindow (img->dpy, img->pix_info_window);
  60. XDrawString(img->dpy, img->pix_info_window, img->gc,
  61.     4, 2 + img->ascent, str, strlen(str));
  62. }
  63.  
  64. void
  65. DrawSpeedWindow(img, s)
  66. image_information *img;
  67. int    s;
  68. {
  69. char str[256];
  70.  
  71.     if (s)    sprintf(str, "%s%d Frames/Second", (s>0) ? "" : "1/", abs(s));
  72.     else    sprintf(str, "As fast as possible");
  73.  
  74.     XClearWindow(img->dpy, img->pix_info_window);
  75.     XDrawString(img->dpy, img->pix_info_window, img->gc,
  76.         4, 2 + img->ascent, str, strlen(str));
  77. }
  78.